.class public Lcom/opongo/blogapp/activities/CopyOfSearchActivity;
.super Landroid/app/ListActivity;
.source "CopyOfSearchActivity.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/opongo/blogapp/activities/CopyOfSearchActivity$downloadNewPostsAsyncTask;
    }
.end annotation


# static fields
.field public static final DEBUG:Z

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private apiManager:Lcom/opongo/blogapp/manager/APIManager;

.field private cat_parent:I

.field public lockLoading:Z

.field private mAdapter:Lcom/opongo/blogapp/adapter/PostCacheListAdapter;

.field private posts:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/opongo/blogapp/common/Post;",
            ">;"
        }
    .end annotation
.end field

.field private searchString:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 26
    sget-boolean v0, Lcom/opongo/blogapp/AbaSettings;->DEBUG:Z

    sput-boolean v0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->DEBUG:Z

    .line 27
    const-class v0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->TAG:Ljava/lang/String;

    .line 24
    return-void
.end method

.method public constructor <init>()V
    .locals 1

    .prologue
    .line 24
    invoke-direct {p0}, Landroid/app/ListActivity;-><init>()V

    .line 35
    const/4 v0, -0x1

    iput v0, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->cat_parent:I

    .line 24
    return-void
.end method

.method static synthetic access$0(Lcom/opongo/blogapp/activities/CopyOfSearchActivity;)Lcom/opongo/blogapp/manager/APIManager;
    .locals 1
    .parameter

    .prologue
    .line 30
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->apiManager:Lcom/opongo/blogapp/manager/APIManager;

    return-object v0
.end method

.method static synthetic access$1(Lcom/opongo/blogapp/activities/CopyOfSearchActivity;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 32
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->searchString:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$2(Lcom/opongo/blogapp/activities/CopyOfSearchActivity;)I
    .locals 1
    .parameter

    .prologue
    .line 35
    iget v0, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->cat_parent:I

    return v0
.end method

.method static synthetic access$3(Lcom/opongo/blogapp/activities/CopyOfSearchActivity;Ljava/util/ArrayList;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 31
    iput-object p1, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->posts:Ljava/util/ArrayList;

    return-void
.end method

.method static synthetic access$4()Ljava/lang/String;
    .locals 1

    .prologue
    .line 27
    sget-object v0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->TAG:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$5(Lcom/opongo/blogapp/activities/CopyOfSearchActivity;)Lcom/opongo/blogapp/adapter/PostCacheListAdapter;
    .locals 1
    .parameter

    .prologue
    .line 29
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->mAdapter:Lcom/opongo/blogapp/adapter/PostCacheListAdapter;

    return-object v0
.end method

.method static synthetic access$6(Lcom/opongo/blogapp/activities/CopyOfSearchActivity;)Ljava/util/ArrayList;
    .locals 1
    .parameter

    .prologue
    .line 31
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->posts:Ljava/util/ArrayList;

    return-object v0
.end method

.method private handleIntent(Landroid/content/Intent;)V
    .locals 3
    .parameter "intent"

    .prologue
    .line 95
    const-string v1, "android.intent.action.SEARCH"

    invoke-virtual {p1}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 96
    const-string v1, "query"

    invoke-virtual {p1, v1}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 97
    .local v0, query:Ljava/lang/String;
    sget-boolean v1, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->DEBUG:Z

    if-eqz v1, :cond_0

    sget-object v1, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->TAG:Ljava/lang/String;

    invoke-static {v1, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 99
    :cond_0
    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->doSearch(Ljava/lang/String;)V

    .line 101
    .end local v0           #query:Ljava/lang/String;
    :cond_1
    return-void
.end method


# virtual methods
.method protected doSearch(Ljava/lang/String;)V
    .locals 2
    .parameter "search"

    .prologue
    .line 104
    iput-object p1, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->searchString:Ljava/lang/String;

    .line 105
    new-instance v0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity$downloadNewPostsAsyncTask;

    const/4 v1, 0x0

    invoke-direct {v0, p0, v1}, Lcom/opongo/blogapp/activities/CopyOfSearchActivity$downloadNewPostsAsyncTask;-><init>(Lcom/opongo/blogapp/activities/CopyOfSearchActivity;Lcom/opongo/blogapp/activities/CopyOfSearchActivity$downloadNewPostsAsyncTask;)V

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Void;

    invoke-virtual {v0, v1}, Lcom/opongo/blogapp/activities/CopyOfSearchActivity$downloadNewPostsAsyncTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 106
    return-void
.end method

.method public onCreate(Landroid/os/Bundle;)V
    .locals 5
    .parameter "savedInstanceState"

    .prologue
    const/4 v4, -0x1

    .line 40
    sget-boolean v1, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->DEBUG:Z

    if-eqz v1, :cond_0

    .line 41
    sget-object v1, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->TAG:Ljava/lang/String;

    const-string v2, "*** create ***"

    invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 43
    :cond_0
    invoke-super {p0, p1}, Landroid/app/ListActivity;->onCreate(Landroid/os/Bundle;)V

    .line 45
    const v1, 0x7f030014

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->setContentView(I)V

    .line 47
    const/4 v1, 0x1

    iput-boolean v1, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->lockLoading:Z

    .line 49
    new-instance v1, Lcom/opongo/blogapp/manager/APIManager;

    invoke-direct {v1, p0}, Lcom/opongo/blogapp/manager/APIManager;-><init>(Landroid/content/Context;)V

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->apiManager:Lcom/opongo/blogapp/manager/APIManager;

    .line 51
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->posts:Ljava/util/ArrayList;

    .line 53
    new-instance v1, Lcom/opongo/blogapp/adapter/PostCacheListAdapter;

    const v2, 0x7f03000f

    iget-object v3, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->posts:Ljava/util/ArrayList;

    invoke-direct {v1, p0, p0, v2, v3}, Lcom/opongo/blogapp/adapter/PostCacheListAdapter;-><init>(Landroid/app/Activity;Landroid/content/Context;ILjava/util/ArrayList;)V

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->mAdapter:Lcom/opongo/blogapp/adapter/PostCacheListAdapter;

    .line 55
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->mAdapter:Lcom/opongo/blogapp/adapter/PostCacheListAdapter;

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->setListAdapter(Landroid/widget/ListAdapter;)V

    .line 58
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->getIntent()Landroid/content/Intent;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v0

    .line 61
    .local v0, extras:Landroid/os/Bundle;
    if-eqz v0, :cond_1

    .line 63
    const-string v1, "CAT_PARENT"

    invoke-virtual {v0, v1, v4}, Landroid/os/Bundle;->getInt(Ljava/lang/String;I)I

    move-result v1

    iput v1, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->cat_parent:I

    .line 66
    :cond_1
    iget v1, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->cat_parent:I

    if-ne v1, v4, :cond_2

    .line 67
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->getIntent()Landroid/content/Intent;

    move-result-object v1

    invoke-direct {p0, v1}, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->handleIntent(Landroid/content/Intent;)V

    .line 70
    :goto_0
    return-void

    .line 69
    :cond_2
    const/4 v1, 0x0

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->doSearch(Ljava/lang/String;)V

    goto :goto_0
.end method

.method protected onListItemClick(Landroid/widget/ListView;Landroid/view/View;IJ)V
    .locals 5
    .parameter "l"
    .parameter "v"
    .parameter "position"
    .parameter "id"

    .prologue
    const/4 v4, 0x0

    .line 75
    invoke-super/range {p0 .. p5}, Landroid/app/ListActivity;->onListItemClick(Landroid/widget/ListView;Landroid/view/View;IJ)V

    .line 77
    const v3, 0x7f080029

    invoke-virtual {p2, v3}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/TextView;

    .line 79
    .local v1, mTitleText:Landroid/widget/TextView;
    const/16 v3, 0x40

    invoke-static {v3, v4, v4, v4}, Landroid/graphics/Color;->argb(IIII)I

    move-result v3

    invoke-virtual {v1, v3}, Landroid/widget/TextView;->setTextColor(I)V

    .line 81
    new-instance v0, Landroid/content/Intent;

    const-class v3, Lcom/opongo/blogapp/activities/PostViewActivity;

    invoke-direct {v0, p0, v3}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 82
    .local v0, intent:Landroid/content/Intent;
    iget-object v3, p0, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->posts:Ljava/util/ArrayList;

    invoke-virtual {v3, p3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/opongo/blogapp/common/Post;

    .line 83
    .local v2, p:Lcom/opongo/blogapp/common/Post;
    const-string v3, "POST"

    invoke-virtual {v0, v3, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/io/Serializable;)Landroid/content/Intent;

    .line 84
    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->startActivity(Landroid/content/Intent;)V

    .line 85
    return-void
.end method

.method protected onNewIntent(Landroid/content/Intent;)V
    .locals 0
    .parameter "intent"

    .prologue
    .line 90
    invoke-virtual {p0, p1}, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->setIntent(Landroid/content/Intent;)V

    .line 91
    invoke-direct {p0, p1}, Lcom/opongo/blogapp/activities/CopyOfSearchActivity;->handleIntent(Landroid/content/Intent;)V

    .line 92
    return-void
.end method
